import React from 'react';
import axios from 'axios';
import withRouter from '../../router/withRouter'
import './Cateinfo.scss'


class Cateinfo extends React.Component {
    componentDidMount() {
        let { search } = this.props;
        let id = search.get("cate_id")
        axios.get(`/douyu/api/RoomApi/live/${id}`)
            .then((res) => {
                this.setState({
                    cate: res.data.data
                })
            })
    }
    state = {
        cate: []
    }
    render() {
        let { cate } = this.state;
        console.log(cate);
        return (
            <div className='cateinfo'>
                {cate.length !== 0 &&
                    <ul>
                        {cate.map(item => {
                            return <li key={item.room_id}>
                                <img src={item.room_src} alt="" />
                                <p>{item.room_name}</p>
                            </li>
                        })}
                    </ul>
                }
            </div>
        )
    }
}
export default withRouter(Cateinfo)